package com.wind.plugin.coutFunc;

import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.TextAnnotationGutterProvider;
import com.intellij.openapi.editor.colors.ColorKey;
import com.intellij.openapi.editor.colors.EditorFontType;
import org.jetbrains.annotations.Nullable;

import java.awt.*;
import java.util.Collections;
import java.util.List;
import java.util.Map;

public class CountFuncTextAnnotationGutterProvider implements TextAnnotationGutterProvider {

    private Map<Integer, Integer> map;

    public CountFuncTextAnnotationGutterProvider(Map<Integer, Integer> hashMap) {
        this.map = hashMap;
    }

    @Nullable
    @Override
    public String getLineText(int i, Editor editor) {
        if(map.containsKey(i)){
            return "函数个数:" + map.get(i);
        }
        return "";
    }

    @Nullable
    @Override
    public String getToolTip(int i, Editor editor) {
        return "";
    }

    @Override
    public EditorFontType getStyle(int i, Editor editor) {
        return null;
    }

    @Nullable
    @Override
    public ColorKey getColor(int i, Editor editor) {
        if(map.containsKey(i)){
            return ColorKey.find("white");
        }
        return null;
    }

    @Nullable
    @Override
    public Color getBgColor(int i, Editor editor) {
        return null;
    }

    @Override
    public List<AnAction> getPopupActions(int i, Editor editor) {
        return Collections.emptyList();
    }

    @Override
    public void gutterClosed() {

    }
}
